package com.jeomo.sys.api.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.jeomo.common.core.enums.IBaseEnum;

/**
 * <h3>jeomo</h3>
 * <p>组织类型</p>
 *
 * @author : qibotian
 * @date : 2020-10-21 09:55
 **/
public enum OrgTypeEnum implements IBaseEnum {

    /**
     * 门店
     */
    MALL("1", "门店"),

    /**
     * 分组
     */
    MALL_GROUP("2", "分组");


    @EnumValue
    private String code;

    private String name;

    OrgTypeEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    @JsonCreator  //枚举入参注解
    public static OrgTypeEnum getByCode(String code) {
        for(OrgTypeEnum rt : values()) {
            if(rt.getCode().equals(code)) {
                return rt;
            }
        }
        return null;
    }

    @JsonValue
    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

}
